#pragma once

#include <vector>
#include <string>

/// CToken types
#define TOKEN_EOF			0
#define TOKEN_IDENT			1
#define TOKEN_STRING		2
#define TOKEN_NAME			3
#define TOKEN_INTEGER		4
#define TOKEN_FLOAT			5
#define TOKEN_NUMBER		6

/// CToken
struct CToken
{
	// data
	int				m_id;
	std::string		m_text;
	double			m_number;

	// location
	std::string		m_file;
	int				m_line;

	CToken()
		: m_id( TOKEN_EOF )
		, m_number( 0 )
		, m_file( "unknown" )
		, m_line( -1 )
	{}
};

/// Stream of tokens
struct CTokenStream
{
public:
	CTokenStream( const std::vector< CToken >& tokens );

	// reset stream
	void Reset();

	// get next token
	// returns empty token at end
	const CToken* Get();

	// peek next token
	// returns empty token at end
	const CToken* Peek();

	// end of token stream ?
	const bool End() const;

private:
	const std::vector< CToken >*	m_tokens;
	int								m_current;
};
